<template>
  <el-input
    :value="value"
    :placeholder="placeholder"
    :style="'width: ' + width + ';'"
    @input="inputChange($event)"
  >
    <template slot="append">Hz</template>
  </el-input>
</template>

<script>
import { controlAmount } from '@/utils'

export default {
  name: 'ElInputFreq',
  props: {
    value: String,
    placeholder: String,
    width: {
      type: String,
      default: '330px'
    },
    isPositive: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    inputChange(val) {
      this.$emit('input', controlAmount(val, this.isPositive))
    },
    makeFrequency() {
      alert(this.value)
      this.value = controlAmount(this.value, this.isPositive)
    }
  }
}
</script>
